package com.zc.im.mapper.im.group;

import com.zc.im.model.im.group.ZcImUnreadNum;
import com.zc.im.model.im.group.ZcImUnreadNumExample;
import com.zc.im.model.im.group.ZcImUnreadNumKey;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

public interface ZcImUnreadNumMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_unread_num
     *
     * @mbggenerated
     */
    int countByExample(ZcImUnreadNumExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_unread_num
     *
     * @mbggenerated
     */
    int deleteByExample(ZcImUnreadNumExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_unread_num
     *
     * @mbggenerated
     */
    @Delete({
        "delete from zc_im_unread_num",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(ZcImUnreadNumKey key);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_unread_num
     *
     * @mbggenerated
     */
    @Insert({
        "insert into zc_im_unread_num (id, type, ",
        "send_user_type, send_user_id, ",
        "target_obj_id, unread_num, ",
        "start_time, end_time, ",
        "company_id, status)",
        "values (#{id,jdbcType=INTEGER}, #{type,jdbcType=VARCHAR}, ",
        "#{sendUserType,jdbcType=VARCHAR}, #{sendUserId,jdbcType=INTEGER}, ",
        "#{targetObjId,jdbcType=INTEGER}, #{unreadNum,jdbcType=INTEGER}, ",
        "#{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, ",
        "#{companyId,jdbcType=INTEGER}, #{status,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=true, resultType=Integer.class)
    int insert(ZcImUnreadNum record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_unread_num
     *
     * @mbggenerated
     */
    int insertSelective(ZcImUnreadNum record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_unread_num
     *
     * @mbggenerated
     */
    List<ZcImUnreadNum> selectByExample(ZcImUnreadNumExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_unread_num
     *
     * @mbggenerated
     */
    @Select({
        "select",
        "id, type, send_user_type, send_user_id, target_obj_id, unread_num, start_time, ",
        "end_time, company_id, status",
        "from zc_im_unread_num",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    ZcImUnreadNum selectByPrimaryKey(ZcImUnreadNumKey key);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_unread_num
     *
     * @mbggenerated
     */
    int updateByExampleSelective(@Param("record") ZcImUnreadNum record, @Param("example") ZcImUnreadNumExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_unread_num
     *
     * @mbggenerated
     */
    int updateByExample(@Param("record") ZcImUnreadNum record, @Param("example") ZcImUnreadNumExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_unread_num
     *
     * @mbggenerated
     */
    int updateByPrimaryKeySelective(ZcImUnreadNum record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_unread_num
     *
     * @mbggenerated
     */
    @Update({
        "update zc_im_unread_num",
        "set type = #{type,jdbcType=VARCHAR},",
          "send_user_type = #{sendUserType,jdbcType=VARCHAR},",
          "send_user_id = #{sendUserId,jdbcType=INTEGER},",
          "target_obj_id = #{targetObjId,jdbcType=INTEGER},",
          "unread_num = #{unreadNum,jdbcType=INTEGER},",
          "start_time = #{startTime,jdbcType=TIMESTAMP},",
          "end_time = #{endTime,jdbcType=TIMESTAMP},",
          "company_id = #{companyId,jdbcType=INTEGER},",
          "status = #{status,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(ZcImUnreadNum record);

    List<ZcImUnreadNum> selectUnreadNumByExample(ZcImUnreadNum record);
}